<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    <h:form id="frmViewFeedBack">
        <f:view>
            <p:contextMenu id="ctMenuFeedBack" for="dlgViewFeedBack">
                <p:menuitem value="New"
                            icon="ui-icon-search"
                            oncomplete="wgCreateFeedBack.show();"
                            update=":frmCreateFeedBack:dlgCreateFeedBack"
                            rendered="#{system.employee}"
                            />
                <p:menuitem value="Reply"
                            icon="ui-icon ui-icon-arrowreturnthick-1-e"
                            oncomplete="wgEditFeedBack.show();"
                            update=":frmEditFeedBack:dlgEditFeedBack"
                            rendered="#{system.manager}"
                            >
                </p:menuitem>
                <p:menuitem value="View Detail"
                            rendered="#{system.employee}"
                            icon="ui-icon ui-icon-arrowreturnthick-1-e"
                            oncomplete="wgEditFeedBack.show();"
                            update=":frmEditFeedBack:dlgEditFeedBack"

                            >
                </p:menuitem>
                <p:menuitem value="Push"
                            icon="ui-icon ui-icon-arrowreturnthick-1-e"
                            oncomplete="wgEditFeedBack.show();"
                            update=":frmEditFeedBack:dlgEditFeedBack"
                            rendered="#{system.employee}"
                            >
                </p:menuitem>
                <p:submenu label="Export" icon="ui-icon-extlink">
                    <p:submenu label="All Data">
                        <p:menuitem value="To Excel 2010"  ajax="false"  >
                            <p:dataExporter type="xls" target="dtViewFeedBack"  fileName="FeedBack" />
                        </p:menuitem>
                        <p:menuitem value="To XML" ajax="false" >
                            <p:dataExporter type="xml" target="dtViewFeedBack" fileName="FeedBack"/>
                        </p:menuitem>
                        <p:menuitem value="To PDF" ajax="false" >
                            <p:dataExporter type="pdf" target="dtViewFeedBack" fileName="FeedBack"/>
                        </p:menuitem>
                    </p:submenu>
                    <p:submenu label="All Data in Page">
                        <p:menuitem value="To Excel 2010" ajax="false" >
                            <p:dataExporter type="xls" target="dtViewFeedBack" fileName="FeedBack" pageOnly="true" />
                        </p:menuitem>
                        <p:menuitem value="To XML" ajax="false" >
                            <p:dataExporter type="xml" target="dtViewFeedBack" fileName="FeedBack" pageOnly="true"/>
                        </p:menuitem>
                    </p:submenu>
                </p:submenu>
            </p:contextMenu>
            <p:focus context="dtViewFeedBack"/>
            <p:dialog id="dlgViewFeedBack"
                      widgetVar="wgViewFeedBack"
                      header="Feedback Information Management"
                      draggable="true"
                      showEffect="clip"
                      hideEffect="clip"
                      >
                <p:dataTable id="dtViewFeedBack"
                             value="#{feedBackManagement.list}"
                             rowKey="#{item.feedbackId}"
                             selection="#{feedBackManagement.selectFeedback}"
                             selectionMode="single"
                             filteredValue="#{feedBackManagement.filteredList}"
                             paginator="true"
                             rows="5"
                             var="item">

                    <p:column  sortBy="#{item.userSend.userName}"
                               filterBy="#{item.userSend.userName}"
                               filterMatchMode="contains"
                               rendered="#{system.manager}"
                               >
                        <f:facet name="header">
                            <h:outputText value="User Send"/>
                        </f:facet>
                        <h:outputText value="#{item.userSend.userName}"/>
                    </p:column>

                    <p:column   sortBy="#{item.feedBackTitle}"
                                filterBy="#{item.feedBackTitle}"
                                filterMatchMode="contains">
                        <f:facet name="header">
                            <h:outputText value="FeedBackTitle"/>
                        </f:facet>
                        <h:outputText value="#{item.feedBackTitle}"/>
                    </p:column>
                 
                    <p:column  sortBy="#{item.feedbackDate.toLocaleString()}"
                               filterBy="#{item.feedbackDate.toLocaleString()}"
                               filterMatchMode="contains">
                        <f:facet name="header">
                            <h:outputText value="FeedbackDate"/>
                        </f:facet>
                        <h:outputText value="#{item.feedbackDate.toLocaleString()}">
                            <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                        </h:outputText>
                    </p:column>

                    <p:column  sortBy="#{item.feedStatus}"
                               filterBy="#{item.feedStatus}"
                               filterMatchMode="exact"
                               filterOptions="#{feedBackManagement.statusOption}"

                               >
                        <f:facet name="header">
                            <h:outputText value="Status"/>
                        </f:facet>
                        <h:outputText value="#{item.feedStatus}"/>
                    </p:column>


                    <p:column  sortBy="#{item.userReply.userName}"
                               filterBy="#{item.userReply.userName}"
                               filterMatchMode="contains">
                        <f:facet name="header">
                            <h:outputText value="Users Reply"/>
                        </f:facet>
                        <h:outputText value="#{item.userReply.userName}"/>
                    </p:column>

                </p:dataTable>
            </p:dialog>
        </f:view>
    </h:form>
</html>
